/*
    This file is part of Posixcpp library.

    Posixcpp library is free software: you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public License
    as published by the Free Software Foundation, either version 3 of
    the License, or (at your option) any later version.

    Posixcpp library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU LesserGeneral Public
    License along with Posixcpp library. If not, see
    <http://www.gnu.org/licenses/>.
 */

#include "posix_threads.hpp"

namespace posix
{
namespace threads
{

std::ostream & operator<<(std::ostream & stream, SchedulerPolicy_t policy)
{
	switch (policy)
	{
	case SchedulerPolicy_t::DEFAULT: stream << "DEFAULT";
		break;
	case SchedulerPolicy_t::ROUND_ROBIN: stream << "ROUND_ROBIN";
		break;
	case SchedulerPolicy_t::FIFO: stream << "FIFO";
		break;
	default: stream << "UNDEFINED";
	}
	return stream;
}
std::ostream & operator<<(std::ostream & stream, SchedulerParameters_t params)
{
	stream << "policy:" << params.policy << " priority:" << params.priority;
	
	return stream;
}
std::ostream & operator<<(std::ostream & stream, CancelState_t state)
{
	switch (state)
	{
	case CancelState_t::ENABLE: stream << "ENABLE";
		break;
	case CancelState_t::DISABLE: stream << "DISABLE";
		break;
	default: stream << "UNDEFINED";
	}
	return stream;
}
std::ostream & operator<<(std::ostream & stream, CancelType_t type)
{
	switch (type)
	{
	case CancelType_t::ASYNCHRONOUS: stream << "ASYNCHRONOUS";
		break;
	case CancelType_t::DEFERRED: stream << "DEFFERED";
		break;
	default: stream << "UNDEFINED";
	}
	return stream;
}
std::ostream & operator<<(std::ostream & stream, SchedulerInheritance_t mode)
{
	switch (mode)
	{
	case SchedulerInheritance_t::INHERIT: stream << "INHERIT";
		break;
	case SchedulerInheritance_t::EXPLICIT: stream << "EXPLICIT";
		break;
	default: stream << "UNDEFINED";
	}
	return stream;
}

}
}
